#include<cstdint>
class Solution {
public:
    int hammingDistance(int x, int y) {
        return cntOnes(x ^ y);
    }
    int cntOnes(int n) {
        unsigned int un = static_cast<unsigned int>(n);
        un = (un & 0x55555555) + ((un >> 1) & 0x55555555);
        un = (un & 0x33333333) + ((un >> 2) & 0x33333333);
        un = (un & 0x0f0f0f0f) + ((un >> 4) & 0x0f0f0f0f);
        un = (un & 0x00ff00ff) + ((un >> 8) & 0x00ff00ff);
        un = (un & 0x0000ffff) + ((un >> 16) & 0x0000ffff);
        return (int)un;
    }
};